
from common import *

def hiBlog(blog_url, username, pwd):
    driver = webdriver.PhantomJS();
    driver.get(blog_url);
    wait = ui.WebDriverWait(driver, 3)
    wait.until(lambda dr: dr.find_element_by_id('userNameIpt').is_displayed())
    driver.find_element_by_id("userNameIpt").send_keys(username)
    driver.find_element_by_id("pwdInput").send_keys(pwd)
    driver.find_element_by_id("btnSubmit").click()
    cookie = [item["name"] + "=" + item["value"] for item in driver.get_cookies()]
    cookiestr = ';'.join(item for item in cookie)
    print(cookiestr)
    driver.save_screenshot('screen.png')
    driver.quit()
    return

    # 执行该文件的主过程
if __name__ == '__main__':
    hiBlog("http://email.163.com", "yzs1013", "~159456!yyangzs~")

